package top.laoshuzi.designpatterns.base.created.singleton.kotlin

/**
 * 懒汉式(同步锁)
 */
class Singleton2 {

    companion object {

        private var instance: Singleton2? = null

        @Synchronized
        fun getInstance(): Singleton2 {
            return instance ?: Singleton2()
        }

    }

    private var name: String = "懒汉式(同步锁)"

    fun getName(): String = name

}
